﻿
@{
    ViewBag.Title = "呼叫记录";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<section class="content-header">
    <h1>
        系统管理
        <small></small>
    </h1>
    <ol class="breadcrumb">
        <li>
            <a href="#"><i class="fa fa-dashboard"></i>主页</a>
        </li>
        <li class="active">呼叫记录</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header">
                    <form id="searchForm" class="form-inline">
                        <div class="form-group">
                            <label>线索ID</label>
                            <input type="text" class="form-control" style="width:200px;" maxlength="50" name="ClueID" autocomplete="off" />
                        </div>
                        <div class="form-group">
                            <label>公司ID</label>
                            <input type="text" class="form-control" style="width:200px;" maxlength="50" name="CompanyID" autocomplete="off" />
                        </div>
                        <div class="form-group">
                            <label>品牌</label>
                            <input type="text" class="form-control" style="width:200px;" maxlength="50" name="Brand" autocomplete="off" />
                        </div>
                        <div class="form-group">
                            <label>车型</label>
                            <input type="text" class="form-control" style="width:200px;" maxlength="50" name="CModel" autocomplete="off" />
                        </div>
                        <div class="form-group">
                            <label>线索创建时间</label>
                            <input type="text" class="form-control" style="width:200px;" name="BCreateDate" id="BCreateDate" autocomplete="off" />
                            -
                            <input type="text" class="form-control" style="width:200px;" name="ECreateDate" id="ECreateDate" autocomplete="off" />
                        </div>
                        <div class="form-group">
                            <button type="button" class="btn btn-success" id="btnSearch">查找</button>
                        </div>
                    </form>
                </div>
                <!-- /.box-header -->
                <div class="box-body table-responsive no-padding">                    
                    <div class="box-body table-responsive no-padding">
                        <table id="table"></table>
                    </div>
                </div>
                <!-- /.box -->
            </div>
        </div>
    </div>
</section>
<style>
    .form-inline .form-group {
        margin-bottom: 5px;
        margin-left: 10px;
    }
</style>

@section scriptsBottom{
    <script type="text/javascript">
        var      listUrl = '@Url.Action("GetCallList", "Report")';

        $(document).ready(function () {
            $("#BCreateDate").datepicker({
                language: "zh-CN",
                autoclose: true,//选中之后自动隐藏日期选择框
                format: "yyyy-mm-dd"//日期格式，
            });
            $("#ECreateDate").datepicker({
                language: "zh-CN",
                autoclose: true,//选中之后自动隐藏日期选择框
                format: "yyyy-mm-dd"//日期格式，
            });

            $("#btnSearch").on("click", function () {
                $('#table').bootstrapTable('refresh');
            });
            init();
        });

        //初始化
        function init() {
            $('#table').bootstrapTable({
                pagination: true,
                sortable: false,
                method: 'post',
                sidePagination: "server",
                queryParamsType: null,
                pageNumber: 1,
                pageSize: 10,
                pageList: [10, 25, 50],
                minimumCountColumns: 2,
                url: listUrl,
                queryParams: function (params) {
                    var query = {
                        PageSize: params.pageSize,
                        PageIndex: params.pageNumber
                    };
                    //return query;
                    var fdata = $("#searchForm").serializeJson();
                    return $.extend(query, fdata);

                },
                columns: [{
                    checkbox: true,
                    formatter: function (value, row, index) {
                        if (row.UploadStatus == 1) {
                            return {
                                disabled: false
                            }
                        } else {
                            return {
                                disabled: true
                            }
                        }
                    }
                },
               {
                   width:20,
                   field: 'ClueID',
                   title: 'ID'
               }, {
                   width: 20,
                   field: 'UserName',
                   title: '用户'
               }, {
                   width: 100,
                   field: 'Brand',
                   title: '品牌'
               }, {
                   width: 100,
                   field: 'Model',
                   title: '车型'
               },  {
                   width: 60,
                   field: 'RingTime',
                    title: '响铃时间'
               },  {
                   width: 100,
                   field: 'BgnTime',
                   title: '接通时间'
               }, {
                    width: 60,
                    field: 'EndTime',
                    title: '挂机时间'
                },  {
                    title: "操作",
                    align: 'center',
                    valign: 'middle',
                    width: 160, // 定义列的宽度，单位为像素px
                    formatter: function (value, row, index) {
                        var fmt = ' <button type="button" class="btn btn-success btn-xs" onclick="callInfo(' + row.ClueID + ')">通话明细</button>';
                        return fmt;
                    }
                }]
            });
        }

        function callInfo(cid) {
            layer.open({
                type: 2,
                title: '外呼明细',
                shadeClose: true,
                shade: 0.3,
                area: ['800px', '500px'],
                content: '@Url.Action("GetCallInfo", "Clue")' + '?clueId=' + cid //iframe的url
            });
        }

    </script>
}

